package aqs;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.ReentrantLock;

@Slf4j
public class Test_waitStatus implements Runnable {
    //ReentrantLock lock = new ReentrantLock();
    ReentrantLock lock = new ReentrantLock(true);

    @Override
    public void run() {
        lock.lock();
        log.info("线程:{},QueueLength:{}" + Thread.currentThread().getName(), lock.getQueueLength());
        lock.unlock();
    }

    public static void main(String[] args) throws InterruptedException {
        Test_waitStatus test = new Test_waitStatus();
        new Thread(test, "A").start();
        new Thread(test, "B").start();
        new Thread(test, "C").start();
        new Thread(test, "D").start();
        new Thread(test, "E").start();

        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();

        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();

        System.out.println("成功");
    }
}
